
/**
 * Copyright 2009 cestum.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
package org.waveprotocol.wave.model.util {
/**
 * StringBuilder...
 **/
public final class StringBuilder {
	private var str:String;
	public function StringBuilder(a:String = null, b:int=0)
	{
		if (a is String) {
			str = String(a);
		}
		if (a == null)
			str = new String();
	}
	
	public function append(a:Object):StringBuilder {
		str = str.concat(a);
		return this;
	}
	public function toString():String {
		return str;
	}
	
	public function remove(start:int, end:int):String {
		str = str.substr(0, start==0 ? 0: start).concat(str.substr(end+1));
		return str;
	}
	
	public function length():int {
		return str.length;
	}
}
}